<{include file="public/header.tpl"}>
<div id="page-wrapper">
	<div class="row">
        <div class="col-md-6">
            <a href="<{$app}>/article/add" class="btn btn-success">添加文章</a>
        </div>
        <div class="col-md-6">
           
                <div class="form-group input-group">
                    <input type="text" class="form-control" name="key" placeholder="输入链接标题或者地址关键词搜索">
                    <span class="input-group-btn">
                      <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
                    </span>
                </div>
        
        </div>
    </div>
	<{ include file="public/title.tpl" }>
    <form  method="post" action="<{$url}>/fpro/page/<{$page}><{if $smarty.get.pid}>/pid/<{$smarty.get.pid}><{/if}><{if $smarty.get.search}>/search/<{$smarty.get.search}><{/if}><{if $smarty.get.audit}>/audit/<{$smarty.get.audit}><{/if}>">

    <li class="list-group-item">
			请按分类选择文档&nbsp;&nbsp; <{ $select }>	
			&nbsp;&nbsp; 
			<input id="sea" type="text" value="<{$search}>"> 
			<button  onclick="search()" class="btn btn-primary">搜&nbsp;&nbsp;索</button>
			<script>
				var sel=document.getElementById("sel");
				
				sel.onchange=function(){
					var pid=this.options[this.selectedIndex].value;
					window.location="<{$url}>/index/pid/"+pid;
				}

				function search(){
					var pid=sel.options[sel.selectedIndex].value;
					var sval=document.getElementById("sea").value;	
					window.location="<{$url}>/index/pid/"+pid+"/search/"+sval;

				}
			</script>
	</li>	
	
	<table class="table table-hover table-striped">
    <thead>
        <tr>
            <th>标题</th>
            <th>作者</th>
            <th>添加时间</th>
            <th>评论</th>
            <th>审核</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
  		<{ section name=doc loop=$arts }>
        <tr>
            <td><input type="checkbox" name="id[]" value="<{ $arts[doc].id }>">
            <a href="<{$root}>/index.php/article/details/aid/<{$arts[doc].id}>" target="_blank">
			<{ $arts[doc].title|truncate:50 }></a></td>
            <td><{ $arts[doc].author }></td>
            <td><{ $arts[doc].posttime|date_format:"%Y-%m-%d" }></td>
            <td>
            	<{if $arts[doc].allow eq 1 }>
					<span onclick="set(this,'allow',<{$arts[doc].id}> )" style="color:#FE488B;cursor:pointer;">√</span>
				<{else}>
					<span onclick="set(this,'allow',<{$arts[doc].id}>)" style="color:#0000F6;cursor:pointer;">×</span>
				<{/if}>
			</td>
            <td>
           	    <{if $arts[doc].audit eq 1 }>
					<span onclick="set(this,'audit',<{$arts[doc].id}>)" style="color:#FE488B;cursor:pointer;">√</span>
				<{else}>
					<span onclick="set(this,'audit',<{$arts[doc].id}>)" style="color:#0000F6;cursor:pointer;">×</span>
				<{/if}>
			</td>
			<td>
			【<a href="<{$url}>/mod/id/<{ $arts[doc].id }>">修改</a>】
			【<a onclick="return confirm('确定要删除文章<{ $arts[doc].title }>吗？')" href="<{$url}>/del/id/<{ $arts[doc].id }>/page/<{$page}><{if $smarty.get.pid}>/pid/<{$smarty.get.pid}><{/if}><{if $smarty.get.search}>/search/<{$smarty.get.search}><{/if}><{if $smarty.get.audit}>/audit/<{$smarty.get.audit}><{/if}>">删除</a>】</td>
        </tr>
        <{ sectionelse }>
			本页没有文章
	    <{ /section }>
  
    </tbody>
    </table>
	<script>
		function set(obj, stat, id){
		var ajax=Ajax();

		if(obj.innerHTML=="√"){
			ajax.get("<{$url}>/status/s/"+stat+"/id/"+id+"/val/0", function(data){
				if(data=="1"){
					ieff(obj, "×");
					obj.style.color="#0000F6";
				}
			
			});
				
		}else{
			ajax.get("<{$url}>/status/s/"+stat+"/id/"+id+"/val/1", function(data){
				if(data=="1"){
					ieff(obj, "√");
					obj.style.color="#FE488B";
				}
				
			});

		}
				
		}
	</script>				
	
	<li class="list-group-item">
		<div class="row" style="width:100%;margin-top:10px;" > 
			<a href="javascript:select()">&nbsp;全选</a>/<a href="javascript:fanselect()">反选</a>/<a href="javascript:noselect()">全不选</a>&nbsp;&nbsp;选中项: 
			<input  name="allows" type="image" title="充许评论"  src="<{$res}>/images/pl1.gif">&nbsp;&nbsp;
			<input  name="nallows" type="image" title="不能评论"  src="<{$res}>/images/pl2.gif">&nbsp;&nbsp;
		
			<input  name="audits" type="image" title="审核"  src="<{$res}>/images/audit.gif">&nbsp;&nbsp;
			<input  name="locks" type="image" title="锁定"  src="<{$res}>/images/lock.gif">&nbsp;&nbsp;
		
			<input  name="dels" type="image" title="删除" onClick="return confirm('你确定要删除选中的文章项吗?')"  src="<{$res}>/images/delete.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

			<a style='<{if $smarty.get.audit eq "on"}>background:#888;color:white<{/if}>' href="<{$url}>/index/audit/on">审核过的</a>&nbsp;|
			<a style='<{if $smarty.get.audit eq "off"}>background:#888;color:white<{/if}>' href="<{$url}>/index/audit/off">末审核的</a>
			<span  style="float:right;">
				<{$fpage}>
			</span>		
		 </div> 
			    
	</li>
   </form>
</div>
<{include file="public/footer.tpl"}>	


